#!/bin/sh
# This regression test is a part of SIPp.
# With -t ui, an -ip_field address of 300 characters (127.0.0.1 with
# zeros) is taken whole, not cut to 255, which made it 127.0.0.0: the
# UAS binds it and the UAC's call goes out from it.
. "`dirname "$0"`/../functions"; init

printf 'SEQUENTIAL\n127.0.0.%s;\n' `printf '%0292d' 1` >ips.csv
sippbg -sn uas -t ui -inf ips.csv -ip_field 0 -i 127.0.0.1 -p 26242 -m 1 \
    -timeout 10 -timeout_error
uas=$pid
sippfg -sn uac -t ui -inf ips.csv -ip_field 0 -m 1 -i 127.0.0.1 \
    -p 26243 127.0.0.1:26242 -timeout 5 -timeout_error >/dev/null 2>&1
status=$?
wait $uas
uas_status=$?
rm -f ips.csv

if test $status -ne 0; then
    fail "UAC failed with $status"
elif test $uas_status -ne 0; then
    fail "UAS failed with $uas_status"
else
    ok
fi
